package model.information;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Observable;

/**
 * A class that represents a Contact
 * @author Tobias Møller Kjærsgaard
 * @author Hjalte Blichfeldt Flyger
 * @author Gitte Simonsen
 * @author Claus Lund
 */
public class Contact extends Observable implements Serializable {
    private String firstName;
    private String lastName;
    private String adress;
    private String postalCode;
    private String city;
    private String country;
    private String email;
    private ArrayList<ContactPhoneNumber> phoneNumbers;

    public Contact(String fn, String ln) {
        firstName = fn;
        lastName = ln;
        phoneNumbers = new ArrayList<ContactPhoneNumber>();
    }

    public Contact(String firstName, String lastName, String adress, String postalCode, String city, String country, String email) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.adress = adress;
        this.postalCode = postalCode;
        this.city = city;
        this.country = country;
        this.email = email;
    }

    public String getAdress() {
        return adress;
    }

    public void setAdress(String adress) {
        this.adress = adress;
        this.setChanged();
        this.notifyObservers("contact");
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
        this.setChanged();
        this.notifyObservers("contact");
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
        this.setChanged();
        this.notifyObservers("contact");
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
        this.setChanged();
        this.notifyObservers("contact");
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
        this.setChanged();
        this.notifyObservers("contact");
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
        this.setChanged();
        this.notifyObservers("contact");
    }

    public String getPostalCode() {
        return postalCode;
    }

    public void setPostalCode(String postalCode) {
        this.postalCode = postalCode;
        this.setChanged();
        this.notifyObservers("contact");
    }

    public void addPhoneNumber(ContactPhoneNumber pn) {
        phoneNumbers.add(pn);
        this.setChanged();
        this.notifyObservers("contact");
    }

    public void removePhoneNumber(ContactPhoneNumber pn) {
        phoneNumbers.remove(pn);
        this.setChanged();
        this.notifyObservers("contact");
    }

    public ArrayList<ContactPhoneNumber> getPhoneNumbers() {
        return phoneNumbers;
    }

    @Override
    public String toString() {
        return firstName + " " + lastName;
    }


    
}